<?
	$image = new Image();

	if($file = upload("image")){

		$_POST['banner'] = $file[0];

		$image->load($file[1]);
		$image->maxWidth(950);
		$image->maxHeight(330);
		$image->save($file[1]);

		$image->load($file[1]);
		$image->maxWidth(680);
		$image->save(Files::add_prefix($file[1],"-md"));

		$_POST['image'] = Files::add_prefix($file[0],"-md");

		$image->load($file[1]);
		$image->resizeAndCrop(180, 135);
		$image->save(Files::add_prefix($file[1],"-th"));

		$_POST['thumb'] = Files::add_prefix($file[0],"-th");
	}

    $db->insert("promotion", $_POST);

    redirect("index.php");
?>